<template>
  <el-select
    :style="{width:setW+'px'}"
    @change="change"
    clearable
    :multiple="isMore"
    :disabled="disabled"
    placeholder="请选择"
    v-model="rawData[type]"
  >
    <el-option
      v-for="item in options"
      :key="item.opValue"
      :label="item.opValue"
      :value="item.opKey"
    ></el-option>
  </el-select>
</template>
<script>
export default {
  props: {
    rawData: {
      type: Object
    },
    code: String,
    type: String,
    isMore: {
      type: Boolean,
      default: false
    },
    setW: String,
    itemData: {
      type: Array,
      default: () => []
    },
    isNoShow: {
      type: Boolean,
      default: false
    },
    disabled: {
      type: Boolean,
      default: false
    }
  },
  mounted() {},
  methods: {
    change() {
      this.$emit("selectChange", this.rawData[this.type]);
    }
  },

  computed: {
    options() {
      var val = [];
      if (isNoEmpty(this.itemData)) {
        val = this.itemData;
      } else {
        var list = enumList(this.code, this.type);

        for (let i = 0; i < list.length; i++) {
          if (this.isNoShow) {
            if (
              list[i].opValue != "草稿" &&
              list[i].opValue != "等待" &&
              list[i].opValue != "比亚迪发票" &&
              list[i].opValue != "美亚保险" &&
              list[i].opValue != "获取账号" &&
              list[i].opValue != "账号密码和ca证书" &&
              list[i].opValue != "高校设备" &&
              list[i].opValue != "特殊类型"
            ) {
              val.push(list[i]);
            }
          } else {
            val.push(list[i]);
          }
        }
      }

      return val;
    }
  }
};
</script>
